﻿package com.tudou.home.common.utils
{
    import com.tudou.utils.*;
    import flash.text.*;

    public class TextFormatStyleSheetUtil extends Object
    {

        public function TextFormatStyleSheetUtil()
        {
            return;
        }// end function

        public static function toStyleSheet(param1:TextFormat) : Object
        {
            var _loc_2:Object = {};
            _loc_2.textAlign = param1.align;
            _loc_2.textIndent = param1.blockIndent;
            _loc_2.fontWeight = param1.bold ? ("bold") : ("normal");
            _loc_2.color = ColorUtil.AsToHtmlColor(uint(param1.color));
            _loc_2.display = param1.display;
            _loc_2.fontFamily = param1.font;
            _loc_2.fontStyle = param1.italic ? ("italic") : ("normal");
            _loc_2.kerning = param1.kerning;
            _loc_2.leading = param1.leading;
            _loc_2.marginLeft = param1.leftMargin;
            _loc_2.marginRight = param1.rightMargin;
            _loc_2.letterSpacing = param1.letterSpacing;
            _loc_2.fontSize = param1.size;
            _loc_2.textDecoration = param1.underline ? ("underline") : ("none");
            return _loc_2;
        }// end function

        public static function toTextFormat(param1:Object) : TextFormat
        {
            var _loc_2:* = new TextFormat();
            _loc_2.align = param1.textAlign;
            _loc_2.bold = param1.fontWeight == "bold";
            _loc_2.color = ColorUtil.htmlToAsColor(param1.color);
            _loc_2.display = param1.display;
            _loc_2.font = param1.fontFamily;
            _loc_2.italic = param1.fontStyle == "italic";
            _loc_2.kerning = param1.kerning;
            _loc_2.leading = param1.leading;
            _loc_2.leftMargin = param1.marginLeft;
            _loc_2.rightMargin = param1.marginRight;
            _loc_2.letterSpacing = param1.letterSpacing;
            _loc_2.size = param1.fontSize;
            _loc_2.underline = param1.textDecoration == "underline" ? (true) : (false);
            return _loc_2;
        }// end function

    }
}
